<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/jquery-1.12.4.min.js"></script>
 <!--  <style>
    div{width: 1000px;height: 1000px;background-color: pink;}
  </style> -->
</head>
<body>
  <ul></ul>
</body>
</html>
<script>
  $(document).mousedown(function(e){
    console.log(e); //e:形参，表示的是event对象，包含当前时间的相关信息
    var startY =e.offsetY;
    $(document).mouseup(function(e2){//每次mousedown都会绑定一次mouseup(JQ同个事件源可以同时绑定多个相同的事件)
      var endY=e2.offsetY;
      if(startY-endY>10){
        console.log("up");
      }else if(startY-endY<-10){
        console.log("down");
      }
      $(document).off("mouseup");
    })
  })
  /* var p=1;
    $(function(){
       $.ajax({
         type:"get",
         url:"http://teach.mengmacoding.com/interface/news.php",
         data:{page:p},
         dataType:"json",
         success:function(data){
           console.log(data)
           var j="";
           for(var i in data){
             j+=('<p>'+data[i].content+'</p>')
           }
           $('body').after('<p>'+j+'</p')
            var p=p++;
          $(window).scroll(function(){
            if($(document).scrollTop<=0){
              alert("滚动条已经到达顶部为0");
            }
            if($(document).scrollTop()>=$(document).height-$(window).height()){
              console.log(n);
            }
          })
         }
       })
    }) */
</script>